// 导入
import Cookie from 'js-cookie';
import { ref, onMounted, nextTick } from 'vue';
// 存到cookie的名称
const tokenKey = 'tokenKey';

// 导出获取函数
export function getToken () {
	return Cookie.get(tokenKey);
}

// 导出设置函数
export function setToken (token) {
	return Cookie.set(tokenKey, token);
}

// 导出删除函数
export function removeToken () {
	return Cookie.remove(tokenKey);
}

// 判断元素是否在视口中
export function isElementInViewport (el) {
	var rect = el.getBoundingClientRect();

	return (
		rect.top >= 0 &&
		rect.left >= 0 &&
		rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
		rect.right <= (window.innerWidth || document.documentElement.clientWidth)
	);
}




